<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/11/24
 * Time: 10:02
 */

namespace Api\Controller;
use Api\Vendor\NetWarehourse\WHOrderNotify;
use Api\Vendor\NetWarehourse\WHOrderPackage;
use Api\Vendor\NetWarehourse\WHOrderStatusUpload;
use Api\Vendor\NetWarehourse\WHRequestBase;
use Shop\Api\OrdersApi;
use Shop\Api\OrdersContactInfoApi;
use Shop\Api\OrdersItemApi;
use Shop\Api\OrderStatusHistoryApi;
use Shop\Model\OrdersModel;
use Shop\Model\OrderStatusHistoryModel;


/**
 * 网仓接口
 * Class WHService
 * @package Api\Vendor\NetWarehourse
 */
class NetWHController extends ApiController {

    private $httpEngine;

    public  function  _init(){
        parent::_init();
        $this->httpEngine = new WHRequestBase();
    }

    /**
     * 3.2 调用网仓接口来推送订单
     */
    public function order_notify(){

        addLog("NetWH/order_notify",$_GET,$_POST,"[调试]3.2  调用网仓接口来推送订单",true);
        $order_code = $this->_post("order_code","","必须传入订单编号!");
        $this->httpEngine = new WHOrderNotify();
        $result = $this->httpEngine->request($order_code);

        if($result['status']){
            $this->apiReturnErr($result['info']);
        }else{
            $this->apiReturnSuc($result['info']);
        }
    }




    /**
     * 3.3 下发发货订单打包指令接口
     */
    public function package_notify(){

        addLog("NetWH/package_notify",$_GET,$_POST,"[调试]3.3  下发发货订单打包指令接口",true);

        $order_code = $this->_post("order_code","","必须传入订单编号!");

        $this->httpEngine = new WHOrderPackage();
        $result = $this->httpEngine->request($order_code);

        if($result['status']){
            $this->apiReturnErr($result['info']);
        }else{
            $this->apiReturnSuc($result['info']);
        }

    }

}